package io.shallwe.front;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.jfinal.aop.Inject;
import com.jfinal.kit.Ret;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;

import io.shallwe._admin.basedata.scanner.ScannerService;
import io.shallwe.common.model.Account;
import io.shallwe.history.ParameterCurveService;

/***
 * 下线显示屏
 */
public class ExitService {
	
	@Inject ScannerService scannerService;
	@Inject ParameterCurveService parameterCurveService;

	public Ret paginate(Integer offset, Integer pageSize) {
		Page<Record> paginate = Db.template("exit.paginate").paginate(1, 7);
		List<Record> list = paginate.getList();
		//Record scannerRecord = getScannerRecord("172.30.31.56");
		List<Record> newList=new ArrayList<>();
		//newList.add(scannerRecord);
		for(int i=0;i<list.size();i++){
			Record record = list.get(i);
			if(parameterCurveService.checkProduct(record.get("barcode"))){
				record.set("status","OK");
			}else{
				record.set("status","NG");
			}
			newList.add(record);
		}
//		newList.addAll(list);
		Ret ret = Ret.by("total",8).set("rows",newList );
		return ret;
	}
	

}
